home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Jugar con las fuentes / BaselineTilt / BaselineTilt.cs next >
Encoding:
Text File  |  2002-05-09  |  1.0 KB  |  37 lines

  1. //-------------------------------------------
  2. // BaselineTilt.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8.  
  9. class BaselineTilt: FontMenuForm
  10. {
  11.      public new static void Main()
  12.      {
  13.           Application.Run(new BaselineTilt());
  14.      }
  15.      public BaselineTilt()
  16.      {
  17.           Text = "Inclinar lφnea base";
  18.  
  19.           strText = "Lφnea base";
  20.           font = new Font("Times New Roman", 144);
  21.      }
  22.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  23.      {
  24.           float yBaseline = 3 * cy / 4;
  25.           float cyAscent = GetAscent(grfx, font);
  26.  
  27.           grfx.DrawLine(new Pen(clr), 0, yBaseline, cx, yBaseline);
  28.  
  29.           grfx.TranslateTransform(0, yBaseline);
  30.  
  31.           Matrix matx = grfx.Transform;
  32.           matx.Shear(-0.5f, 0);
  33.           grfx.Transform = matx;
  34.  
  35.           grfx.DrawString(strText, font, new SolidBrush(clr), 0, -cyAscent);
  36.      }
  37. }